use std::collections::HashMap;
use serde_json::{Value, Result};

struct CacheInfo {
    age: int,
    persist: bool, 
}

struct SiteData {
    sources: Vec<Value>,
    mirrors: Vec<Value>,
}

trait DataSource {
    fn get_name(&self) -> str;
    fn get_cache_info(&self) -> CacheInfo;
    fn get_site_data(&self, site_list: Option<Vec<&str>>) -> HashMap<str, SiteData>;
}

fn new_data_source(data_source_name: &str, params: Value) -> DataSource {
    return match params["source-type"].as_str().unwrap() {
        "local-file" => {
            DataSourceLocalFile { name: data_source_name, params: params };
        }
        "local-dir" => {
            DataSourceLocalDir { name: data_source_name, params: params };
        }
        "httpdir" => {
            DataSourceHttpDir { name: data_source_name, params: params };
        }
        "mirrors" => {
            DataSourceMirrors { name: data_source_name, params: params };
        }
    }
}
